<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/login.css" />
<title>로그인 폼</title>
<script type="text/javascript" src="./js/jquery.validate.js"></script>
<script type="text/javascript">
	(function($) {
		$(document).ready(function() {
			if($("#email").val().length != 0){
				$("#user_pw").focus();
			}else{
				$("#email").focus();
			}
			$("#error_msg_null").validate({
				rules : {
					email : {
						required : true,
						email : true
					},
					user_pw : {
						required : true
					},
				},
/*  				messages : {
					email : {
						required :"이메일을 입력하세요",
						email : "이메일이 올바르지 않습니다"
					},
					user_pw : {
						required : "비밀번호를 입력하세요"
					},
				}, */
				submitHandler : function(frm) {
					frm.submit();
				},
				success : function(e) {
				}
			});
		});
	})(jQuery);
</script>
<style type="text/css">
input.error,textarea.error {
	border: 1px solid #DB0000;
}

</style>
</head>
<body>
<%
session.setAttribute("url", session.getAttribute("url"));
%>
<%
if(request.getAttribute("message") != null){
%>
<form name="login_form" id="login_form" method="post" action="login.do">
	
	<div align="center" style = "padding-top: 60px"><img src = 'images/login/lgi_title.jpg'/></div>
	
	<div align="center" style = "padding-bottom: 90px;">
	<fieldset style = "border: 0px; background: #F6F6F6; 
				width: 380px; height: 220px;">
		<p/>
		<div id = 'loginFrm' align = "right">
		<span>이메일</span>
		<input class = 'loginBox' type="text" name="email" id="email" placeholder="이메일 주소" /><p/>
		
		<span>비밀번호</span>
		<input class = 'loginBox' type="password" name="user_pw" id="user_pw" placeholder="비밀 번호"/><br/>
		</div>
		<p/>
		
		<span class = "error_msg_null"><%=request.getAttribute("message") %></span><br/>
		
		<input id = "loginBtn" class="submit" type="submit" value="로그인" 
		style = "width:100px; height:40px; margin-top: 20px;"/><p/>
		<span class = 'findPW'><a href="emailFind.do">이메일 찾기</a> / <a href="pwdFind.do">비밀번호찾기</a></span>	
	</fieldset>
	</div>
	</form>
<%
}else if(request.getAttribute("email") != null){
%>
<form name="login_form" id="login_form" method="post" action="login.do">
	
	<div align="center" style = "padding-top: 60px"><img src = 'images/login/lgi_title.jpg'/></div>
	
	<div align="center" style = "padding-bottom: 90px;">
	<fieldset style = "border: 0px; background: #F6F6F6; 
				width: 380px; height: 220px;">
		<p/>
		<div id = 'loginFrm' align = "right">
		<span>이메일</span>
		<input class = 'loginBox' type="text" name="email" id="email" value=<%=request.getAttribute("email") %> placeholder="이메일 주소" /><p/>
		
		<span>비밀번호</span>
		<input class = 'loginBox' type="password" name="user_pw" id="user_pw" placeholder="비밀 번호"/><p/>
		</div>
		<p/>
		
		<span class = "error_msg_null"></span><br />
		
		<input id = "loginBtn" class="submit" type="submit" value="로그인" 
		style = "width:100px; height:40px; margin-top: 30px;"/><p/>
		<span class = 'findPW'><a href="emailFind.do">이메일 찾기</a> / <a href="pwdFind.do">비밀번호찾기</a></span>	
	</fieldset>
	</div>
	</form>
<%
}else{
%>
<form name="login_form" id="login_form" method="post" action="login.do">
	
	<div align="center" style = "padding-top: 60px"><img src = 'images/login/lgi_title.jpg'/></div>
	
	<div align="center" style = "padding-bottom: 90px;">
	<fieldset style = "border: 0px; background: #F6F6F6; 
				width: 380px; height: 200px;">
		<p/>
		<div id = 'loginFrm' align = "right">
		<span>이메일</span>
		<input class = 'loginBox' type="text" name="email" id="email" placeholder="이메일 주소" /><p/>
		
		<span>비밀번호</span>
		<input class = 'loginBox' type="password" name="user_pw" id="user_pw" placeholder="비밀 번호"/><p/>
		</div>
		<p/>
			
		<input id = "loginBtn" class="submit" type="submit" value="로그인" 
		style = "width:100px; height:40px;"/><p/>
		<span class = 'findPW'><a href="emailFind.do">이메일 찾기</a> / <a href="pwdFind.do">비밀번호찾기</a></span>	
	</fieldset>
	</div>
	</form>
<%
}
%>	
</body>
</html>